package com.medical.doctor.service.impl;

import java.util.List;

import com.medical.common.security.utils.SecurityUtils;
import com.medical.doctor.vo.DiagnosticRecordVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.medical.doctor.mapper.DiagnosticRecordMapper;
import com.medical.doctor.domain.DiagnosticRecord;
import com.medical.doctor.service.IDiagnosticRecordService;

/**
 * 诊断记录Service业务层处理
 * 
 * @author medical
 * @date 2024-07-21
 */
@Service
public class DiagnosticRecordServiceImpl implements IDiagnosticRecordService 
{
    @Autowired
    private DiagnosticRecordMapper diagnosticRecordMapper;

    /**
     * 查询诊断记录
     * 
     * @param diagnoseId 诊断记录主键
     * @return 诊断记录
     */
    @Override
    public DiagnosticRecord selectDiagnosticRecordByDiagnoseId(Long diagnoseId)
    {
        return diagnosticRecordMapper.selectDiagnosticRecordByDiagnoseId(diagnoseId);
    }

    /**
     * 查询诊断记录列表
     *
     * @param diagnosticRecord 诊断记录
     * @return 诊断记录
     */
    @Override
    public List<DiagnosticRecordVo> selectDiagnosticRecordList(DiagnosticRecord diagnosticRecord)
    {
        Long userid = SecurityUtils.getLoginUser().getUserid();
        diagnosticRecord.setUserId(userid);
        return diagnosticRecordMapper.selectDiagnosticRecordList(diagnosticRecord);
    }

    /**
     * 新增诊断记录
     * 
     * @param diagnosticRecord 诊断记录
     * @return 结果
     */
    @Override
    public int insertDiagnosticRecord(DiagnosticRecord diagnosticRecord)
    {
        return diagnosticRecordMapper.insertDiagnosticRecord(diagnosticRecord);
    }

    /**
     * 修改诊断记录
     * 
     * @param diagnosticRecord 诊断记录
     * @return 结果
     */
    @Override
    public int updateDiagnosticRecord(DiagnosticRecord diagnosticRecord)
    {
        return diagnosticRecordMapper.updateDiagnosticRecord(diagnosticRecord);
    }

    /**
     * 批量删除诊断记录
     * 
     * @param diagnoseIds 需要删除的诊断记录主键
     * @return 结果
     */
    @Override
    public int deleteDiagnosticRecordByDiagnoseIds(Long[] diagnoseIds)
    {
        return diagnosticRecordMapper.deleteDiagnosticRecordByDiagnoseIds(diagnoseIds);
    }

    /**
     * 删除诊断记录信息
     * 
     * @param diagnoseId 诊断记录主键
     * @return 结果
     */
    @Override
    public int deleteDiagnosticRecordByDiagnoseId(Long diagnoseId)
    {
        return diagnosticRecordMapper.deleteDiagnosticRecordByDiagnoseId(diagnoseId);
    }
}
